package com.llh.cheap.configs;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.transaction.support.TransactionTemplate;

/**
 * @author David
 */
@Configuration
@ComponentScan(basePackages = "com.qxt.stars")
@Import({
        DatabaseConfig.class
})
public class StarsConfig {

    @Bean("STARS_TT")
    public TransactionTemplate transactionTemplate(@Qualifier("MAIN_TT") TransactionTemplate transactionTemplate) {
        return transactionTemplate;
    }

    @Bean("STARS_DB")
    public JdbcTemplate db(@Qualifier("MAIN_DB") JdbcTemplate jdbcTemplate) {
        return jdbcTemplate;
    }

    @Bean("STARS_NAMED_DB")
    public NamedParameterJdbcTemplate namedDB(@Qualifier("MAIN_NAMED_DB") NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
        return namedParameterJdbcTemplate;
    }

}
